Record a reindex heartbeat on every run for cron observability#10
Merged
Conversation
Skipped/unchanged reindex runs previously left no trace, so a scheduled (cron) run that found docs unchanged was unobservable — Vercel exposes no historical runtime-log or cron-run-history API on this plan. Persist a lightweight heartbeat (checkedAt, trigger, status, reason, docsHash) to Redis key `salem:docs:index:lastcheck` on every evaluation, including skips. recordCheck is optional on ReindexStateStore so existing and test stores stay compatible; the write is best-effort and never fails the reindex. Now every scheduled run is verifiable with one Redis read. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds a persistent “heartbeat” record for each reindex evaluation (including no-op/skip runs) to make scheduled cron execution observable via a single Redis key read.
Changes:
- Added
ReindexHeartbeat+ optionalrecordCheck()toReindexStateStorefor per-run heartbeat persistence. - Implemented Redis-backed heartbeat storage at
salem:docs:index:lastcheck. - Refactored
reindexDocsIfChangedto a single-return flow to ensure heartbeat recording on all decision paths.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes scheduled cron runs observable.
Problem: Skipped/unchanged reindex runs leave no trace, and Vercel exposes no historical runtime-log or cron-run-history API on this plan. So a daily cron run that finds docs unchanged is invisible after the fact — there's no way to confirm it fired.
Fix: Persist a lightweight heartbeat to Redis key
salem:docs:index:lastcheckon every evaluation (including skips):{checkedAt, trigger, status, reason, docsHash}.recordCheckis optional onReindexStateStore— existing/custom/test stores stay compatible.reindexDocsIfChangedrefactored to a single return so the heartbeat is recorded on all paths.Result: every scheduled run is verifiable with one Redis read — confirms the 06:00 UTC cron is firing even when it's a no-op.
Verification:
tsc --noEmitclean;reindex-freshnessunit test passes. Built in an isolated worktree.🤖 Generated with Claude Code